package com.sg.service.biz.app.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.base.app.req.BatchQueryTargetObjPlanExReq;
import com.sg.dto.base.app.req.BatchQueryVirtualOrgMemberReq;
import com.sg.dto.base.app.req.QueryBizAppBatchDetailReq;
import com.sg.dto.base.app.req.QueryVirtualOrgMemberDeptListReq;
import com.sg.dto.biz.app.req.*;
import com.sg.dto.biz.app.res.*;
import com.sg.dto.integration.component.QueryConfItemMatchAnswerDetailComReqDto;
import com.sg.dto.integration.component.QueryConfItemMatchAnswerDetailComRespDto;
import com.sg.dto.integration.framework.QueryPresentInaugurationDeptMgtPowerDetailComReqDto;
import com.sg.dto.integration.framework.QueryPresentInaugurationDeptMgtPowerDetailComRespDto;
import com.sg.entity.OmsBizAppBatch;
import com.sg.entity.OmsTargetObjectivePlanExtend;
import com.sg.entity.OmsVirtualOrgMember;
import com.sg.entity.OmsVirtualOrgMemberDept;
import com.sg.service.base.app.*;
import com.sg.service.biz.app.EvaSystemService;
import com.sg.common.exception.Assert;
import com.wicket.okrcomponent.integration.ConfSchemeService;
import com.wicket.okrframework.integration.PowerService;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class PowerServiceImpl
        implements com.wicket.okrapp.biz.service.PowerService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MOmsVirtualOrgMemberDeptService mOmsVirtualOrgMemberDeptService;
    @Resource
    private MOmsVirtualOrgMemberService mOmsVirtualOrgMemberService;
    //@Resource
    //private MCustomFields2Service mCustomFields2Service;
    @Resource
    private NbPower nbPower;
    @Resource
    private PowerService powerService;
    @Resource
    private EvaSystemService evaSystemService;
    @Resource
    private MOmsBizAppBatchService mOmsBizAppBatchService;
    @Resource
    private MOmsEvaBatchRelatedSetService mOmsEvaBatchRelatedSetService;
    @Resource
    private MOmsTargetObjectivePlanExtendService mOmsTargetObjectivePlanExtendService;
    @Resource
    private MOmsTargetObjectiveService mOmsTargetObjectiveService;
    @Resource
    private ConfSchemeService confSchemeService;
    @Resource
    private MOmsEvaluationObjectTargetCycleService mOmsEvaluationObjectTargetCycleService;
//@Resource
    //private MCustomFields3Service mCustomFields3Service;

    /**
     * D3查询当前个人权限详情[3827]
     * gen by moon at 9/17/2022, 8:04:18 AM
     */
    @Trace(operationName = "D3查询当前个人权限详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryCurrentPersonalPowerDetailRespDto queryCurrentPersonalPowerDetail(QueryCurrentPersonalPowerDetailReqDto reqDto) {


        ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_1 = null;
        ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_3 = null;
        ObtainReceiveFieldRespDto receptionServiceRes_5 = null;
        ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_7 = null;
//virtualUsage D3查询当前部门被评对象目标周期详情(公共)  16511
        QueryCurrentDeptEvaObjTargetCycleDetailComRespDto queryCurrentDeptEvaObjTargetCycleDetailComRespDto = null;
        QueryCurrentDeptEvaObjTargetCycleDetailComReqDto queryCurrentDeptEvaObjTargetCycleDetailComReqDto = new QueryCurrentDeptEvaObjTargetCycleDetailComReqDto();
        if (reqDto != null) {
            queryCurrentDeptEvaObjTargetCycleDetailComReqDto.setDeptId(reqDto.getDeptId());//sourceId:333359_1_16511
            queryCurrentDeptEvaObjTargetCycleDetailComReqDto.setTargetId(reqDto.getTargetId());//sourceId:333360_1_16511
        }

        /*D3查询当前部门被评对象目标周期详情(公共)[4582]   */
        Assert.isNull(queryCurrentDeptEvaObjTargetCycleDetailComReqDto.getDeptId(), "D3查询当前个人权限详情-D3查询当前部门被评对象目标周期详情(公共)-部门ID不能为空", false);
        Assert.isNull(queryCurrentDeptEvaObjTargetCycleDetailComReqDto.getTargetId(), "D3查询当前个人权限详情-D3查询当前部门被评对象目标周期详情(公共)-冗余目标ID不能为空", false);
        queryCurrentDeptEvaObjTargetCycleDetailComRespDto = evaSystemService.queryCurrentDeptEvaObjTargetCycleDetailCom(queryCurrentDeptEvaObjTargetCycleDetailComReqDto);


//virtualUsage D1-2查询当前就职记录部门管理权限详情(公共)  12842
        QueryPresentInaugurationDeptMgtPowerDetailComRespDto queryPresentInaugurationDeptMgtPowerDetailComRespDto = null;
        QueryPresentInaugurationDeptMgtPowerDetailComReqDto queryPresentInaugurationDeptMgtPowerDetailComReqDto = new QueryPresentInaugurationDeptMgtPowerDetailComReqDto();
        if (reqDto != null) {
            queryPresentInaugurationDeptMgtPowerDetailComReqDto.setDeptId(reqDto.getDeptId());//sourceId:190345_1_12842
        }

        /*D1-2查询当前就职记录部门管理权限详情(公共)[3793]   */
        Assert.isNull(queryPresentInaugurationDeptMgtPowerDetailComReqDto.getDeptId(), "D3查询当前个人权限详情-D1-2查询当前就职记录部门管理权限详情(公共)-部门ID不能为空", false);
        queryPresentInaugurationDeptMgtPowerDetailComRespDto = powerService.queryPresentInaugurationDeptMgtPowerDetailCom(queryPresentInaugurationDeptMgtPowerDetailComReqDto).getData();


//virtualUsage 3-6-03查牵头部门的指标列表  16277
        List<OmsVirtualOrgMemberDept> listOmsVirtualOrgMemberDept = new ArrayList<>();
        QueryVirtualOrgMemberDeptListReq queryVirtualOrgMemberDeptListReq = new QueryVirtualOrgMemberDeptListReq();
        queryVirtualOrgMemberDeptListReq.setDeptType("LEAD_DEPT");//sourceId:200236_1_16277
        queryVirtualOrgMemberDeptListReq.setTableTypeCode("OMS_TARGET_OBJECTIVE");//sourceId:200233_1_16277
        queryVirtualOrgMemberDeptListReq.setEvaluationTemplateType("EVA_TEMP");//sourceId:200244_1_16277
        queryVirtualOrgMemberDeptListReq.setIsArchive("FALSE");//sourceId:200959_1_16277
        queryVirtualOrgMemberDeptListReq.setArchivngType("NOT_ARCHIVE");//sourceId:200960_1_16277
        if (reqDto != null) {
            queryVirtualOrgMemberDeptListReq.setDeptId(reqDto.getDeptId());//sourceId:200231_1_16277
            queryVirtualOrgMemberDeptListReq.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//sourceId:200241_1_16277
        }

        /*3-6-03查牵头部门的指标列表[2220]   */
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getDeptId(), "D3查询当前个人权限详情-3-6-03查牵头部门的指标列表-虚拟组织下部门ID不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getDeptType(), "D3查询当前个人权限详情-3-6-03查牵头部门的指标列表-部门类型编码不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getTableTypeCode(), "D3查询当前个人权限详情-3-6-03查牵头部门的指标列表-冗余内容表类型编码不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getEvaluationTemplateType(), "D3查询当前个人权限详情-3-6-03查牵头部门的指标列表-归属对象类型不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getEvaluationTemplateId(), "D3查询当前个人权限详情-3-6-03查牵头部门的指标列表-归属对象ID不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getIsArchive(), "D3查询当前个人权限详情-3-6-03查牵头部门的指标列表-是否存档不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getArchivngType(), "D3查询当前个人权限详情-3-6-03查牵头部门的指标列表-存档类型不能为空", false);
        listOmsVirtualOrgMemberDept = mOmsVirtualOrgMemberDeptService.queryVirtualOrgMemberDeptList(queryVirtualOrgMemberDeptListReq);


//virtualUsage 3-6-02批量查当前用户管理的部门牵头指标  16278
        List<OmsVirtualOrgMember> listOmsVirtualOrgMember = new ArrayList<>();
        if (listOmsVirtualOrgMemberDept != null && listOmsVirtualOrgMemberDept.size() > 0) {
            BatchQueryVirtualOrgMemberReq batchQueryVirtualOrgMemberReq = new BatchQueryVirtualOrgMemberReq();
            batchQueryVirtualOrgMemberReq.setVirtualOrgMemberList(listOmsVirtualOrgMemberDept.stream().map(item -> item.getEntityId())
                    .collect(Collectors.toList()));//sourceId:200246_1_16278
            batchQueryVirtualOrgMemberReq.setTableTypeCode("OMS_TARGET_OBJECTIVE");//sourceId:200249_1_16278
            batchQueryVirtualOrgMemberReq.setVirtualOrgInductionRecordId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID//sourceId:201003_1_16278
            batchQueryVirtualOrgMemberReq.setIsAdmin("TRUE");//sourceId:200259_1_16278
            batchQueryVirtualOrgMemberReq.setArchivngType("NOT_ARCHIVE");//sourceId:200256_1_16278
            batchQueryVirtualOrgMemberReq.setIsArchive("FALSE");//sourceId:200962_1_16278

            /*3-6-02批量查当前用户管理的部门牵头指标[2672]   */
            Assert.isNull(batchQueryVirtualOrgMemberReq.getTableTypeCode(), "D3查询当前个人权限详情-3-6-02批量查当前用户管理的部门牵头指标-冗余内容表类型编码不能为空", false);
            Assert.isNull(batchQueryVirtualOrgMemberReq.getVirtualOrgInductionRecordId(), "D3查询当前个人权限详情-3-6-02批量查当前用户管理的部门牵头指标-虚拟组织成员就职记录ID不能为空", false);
            Assert.isNull(batchQueryVirtualOrgMemberReq.getIsAdmin(), "D3查询当前个人权限详情-3-6-02批量查当前用户管理的部门牵头指标-是否管理员不能为空", false);
            Assert.isNull(batchQueryVirtualOrgMemberReq.getArchivngType(), "D3查询当前个人权限详情-3-6-02批量查当前用户管理的部门牵头指标-存档类型不能为空", false);
            Assert.isNull(batchQueryVirtualOrgMemberReq.getIsArchive(), "D3查询当前个人权限详情-3-6-02批量查当前用户管理的部门牵头指标-是否存档不能为空", false);
            listOmsVirtualOrgMember = mOmsVirtualOrgMemberService.batchQueryVirtualOrgMember(batchQueryVirtualOrgMemberReq);


        }
//virtualUsage M3-有管理权限0  16311
        //ModelCode: receptionService
        ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes = null;
        ImplementBizConstructAccessParameterFieldReqDto receptionServiceReq = new ImplementBizConstructAccessParameterFieldReqDto();
        receptionServiceReq.setOutputNum(0L);//CUSTOM_CONVENTION//sourceId:329520_1_16311

        /*M3-有管理权限0[4518]  用于特殊方法接收上游入参。 */
        Assert.isNull(receptionServiceReq.getOutputNum(), "D3查询当前个人权限详情-M3-有管理权限0-传输数值不能为空", false);
        receptionServiceRes = nbPower.implementBizConstructAccessParameterField(receptionServiceReq);


        receptionServiceRes_1 = receptionServiceRes;
//virtualUsage M3默认不是指标管理员  16285
        //ModelCode: receptionService
        ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_2 = null;
        ImplementBizConstructAccessParameterFieldReqDto receptionServiceReq_1 = new ImplementBizConstructAccessParameterFieldReqDto();
        receptionServiceReq_1.setIsAdmin("FALSE");//sourceId:329410_1_16285

        /*M3默认不是指标管理员[4518]  用于特殊方法接收上游入参。 */
        Assert.isNull(receptionServiceReq_1.getIsAdmin(), "D3查询当前个人权限详情-M3默认不是指标管理员-是否管理员不能为空", false);
        receptionServiceRes_2 = nbPower.implementBizConstructAccessParameterField(receptionServiceReq_1);


        receptionServiceRes_3 = receptionServiceRes_2;
        if ((queryPresentInaugurationDeptMgtPowerDetailComRespDto != null || listOmsVirtualOrgMember != null && listOmsVirtualOrgMember != null && listOmsVirtualOrgMember.size() > 0) && (queryCurrentDeptEvaObjTargetCycleDetailComRespDto != null && queryCurrentDeptEvaObjTargetCycleDetailComRespDto.getEvaObjTargetCycleId() != null)) {
            //if((D1-2查询当前就职记录部门管理权限详情(公共).管理的部门ID 值不等于空  or 3-6-02批量查当前用户管理的部门牵头指标.虚拟组织成员列表数据集条数 大于 0) and D3查询当前部门被评对象目标周期详情(公共).被评对象目标周期ID 值不等于空 )  12843

//ModelCode: receptionService
            ObtainReceiveFieldRespDto receptionServiceRes_4 = null;
            ObtainReceiveFieldReqDto receptionServiceReq_2 = new ObtainReceiveFieldReqDto();
            receptionServiceReq_2.setOutputNum(1L);//CUSTOM_CONVENTION//sourceId:244985_1_16262

            /*M3-有管理权限1[2451]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_2.getOutputNum(), "D3查询当前个人权限详情-M3-有管理权限1-传输数值不能为空", false);
            receptionServiceRes_4 = nbPower.obtainReceiveField(receptionServiceReq_2);


            receptionServiceRes_5 = receptionServiceRes_4;
        }
        if ((listOmsVirtualOrgMember != null && listOmsVirtualOrgMember != null && listOmsVirtualOrgMember.size() > 0 && queryPresentInaugurationDeptMgtPowerDetailComRespDto != null && queryCurrentDeptEvaObjTargetCycleDetailComRespDto != null && queryCurrentDeptEvaObjTargetCycleDetailComRespDto.getEvaObjTargetCycleId() != null)) {
            //if((3-6-02批量查当前用户管理的部门牵头指标.虚拟组织成员列表数据集条数 大于 0 and D1-2查询当前就职记录部门管理权限详情(公共).管理的部门ID 值等于空  and D3查询当前部门被评对象目标周期详情(公共).被评对象目标周期ID 值不等于空 ))  16281

//ModelCode: receptionService
            ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_6 = null;
            ImplementBizConstructAccessParameterFieldReqDto receptionServiceReq_3 = new ImplementBizConstructAccessParameterFieldReqDto();
            receptionServiceReq_3.setIsAdmin("TRUE");//sourceId:329376_1_16282

            /*M3确定是指标管理员[4518]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_3.getIsAdmin(), "D3查询当前个人权限详情-M3确定是指标管理员-是否管理员不能为空", false);
            receptionServiceRes_6 = nbPower.implementBizConstructAccessParameterField(receptionServiceReq_3);


            receptionServiceRes_7 = receptionServiceRes_6;
//processBranchName:正常结束 ,processBranchId:16283

        }
        QueryCurrentPersonalPowerDetailRespDto retData = new QueryCurrentPersonalPowerDetailRespDto();
        if (receptionServiceRes_1 != null) {
            retData.setOutputNum(receptionServiceRes_1.getOutputNum());//sourceId:190698_1
        }
        if (receptionServiceRes_5 != null) {
            retData.setOutputNum(receptionServiceRes_5.getOutputNum());//sourceId:190698_1
        }
// TODO: 2022/9/16 晓东，顺序问题 
        if (receptionServiceRes_3 != null) {
            retData.setIsAdmin(receptionServiceRes_3.getIsAdmin());//sourceId:329412_1
        }
        if (receptionServiceRes_7 != null) {
            retData.setIsAdmin(receptionServiceRes_7.getIsAdmin());//sourceId:329412_1
        }


        return retData;
    }

    /**
     * D3查询中基层个人管理权限详情(公共)[3827]
     * gen by moon at 6/2/2023, 12:04:02 AM
     */
    @Trace(operationName = "D3查询中基层个人管理权限详情(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryMidBasicPersonalPowerDetailComRespDto queryMidBasicPersonalPowerDetailCom(QueryMidBasicPersonalPowerDetailComReqDto reqDto) {


        ObtainReceiveFieldRespDto receptionServiceRes_1 = null;
        ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_3 = null;
        ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_5 = null;
        ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_7 = null;
//virtualUsage D3查询当前部门被评对象目标周期详情(公共)  16511
        QueryCurrentDeptEvaObjTargetCycleDetailComRespDto queryCurrentDeptEvaObjTargetCycleDetailComRespDto = null;
        QueryCurrentDeptEvaObjTargetCycleDetailComReqDto queryCurrentDeptEvaObjTargetCycleDetailComReqDto = new QueryCurrentDeptEvaObjTargetCycleDetailComReqDto();
        if (reqDto != null) {
            queryCurrentDeptEvaObjTargetCycleDetailComReqDto.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:333359_1_16511
            queryCurrentDeptEvaObjTargetCycleDetailComReqDto.setTargetId(reqDto.getTargetId());//SimpleFieldAssign//sourceId:333360_1_16511
        }

        /*D3查询当前部门被评对象目标周期详情(公共)[4582]   */
        Assert.isNull(queryCurrentDeptEvaObjTargetCycleDetailComReqDto.getDeptId(), "D3查询中基层个人管理权限详情(公共)-D3查询当前部门被评对象目标周期详情(公共)-部门ID不能为空", false);
        Assert.isNull(queryCurrentDeptEvaObjTargetCycleDetailComReqDto.getTargetId(), "D3查询中基层个人管理权限详情(公共)-D3查询当前部门被评对象目标周期详情(公共)-冗余目标ID不能为空", false);
        queryCurrentDeptEvaObjTargetCycleDetailComRespDto = evaSystemService.queryCurrentDeptEvaObjTargetCycleDetailCom(queryCurrentDeptEvaObjTargetCycleDetailComReqDto)/*vcase invoke isSameApp*/;


//virtualUsage 3-13-01查业务应用批次（有批次方可进入管理）  16512
        OmsBizAppBatch omsBizAppBatch = null;
        if (queryCurrentDeptEvaObjTargetCycleDetailComRespDto != null && queryCurrentDeptEvaObjTargetCycleDetailComRespDto != null && queryCurrentDeptEvaObjTargetCycleDetailComRespDto.getEvaObjTargetCycleId() != null) {
            QueryBizAppBatchDetailReq queryBizAppBatchDetailReq = new QueryBizAppBatchDetailReq();
            queryBizAppBatchDetailReq.setIsNewbatch("TRUE");//sourceId:333513_1_16512
            if (reqDto != null) {
                queryBizAppBatchDetailReq.setPurposeTypeCode(reqDto.getPurposeTypeCode());//SimpleFieldAssign//sourceId:333509_1_16512
            }
            if (queryCurrentDeptEvaObjTargetCycleDetailComRespDto != null) {
                queryBizAppBatchDetailReq.setAscriptionObjectId(queryCurrentDeptEvaObjTargetCycleDetailComRespDto.getEvaObjTargetCycleId());//SimpleFieldAssign//sourceId:333510_1_16512
            }

            /*3-13-01查业务应用批次（有批次方可进入管理）[2668]   */
            Assert.isNull(queryBizAppBatchDetailReq.getPurposeTypeCode(), "D3查询中基层个人管理权限详情(公共)-3-13-01查业务应用批次（有批次方可进入管理）-用途类型编码不能为空", false);
            Assert.isNull(queryBizAppBatchDetailReq.getAscriptionObjectId(), "D3查询中基层个人管理权限详情(公共)-3-13-01查业务应用批次（有批次方可进入管理）-归属对象ID不能为空", false);
            Assert.isNull(queryBizAppBatchDetailReq.getIsNewbatch(), "D3查询中基层个人管理权限详情(公共)-3-13-01查业务应用批次（有批次方可进入管理）-是否最新批次不能为空", false);
            omsBizAppBatch = mOmsBizAppBatchService.queryBizAppBatchDetail(queryBizAppBatchDetailReq)/*vcase invoke 本地 method 方法调用;*/;


        }
//virtualUsage D1-2查询当前就职记录部门管理权限详情(公共)  12842
        QueryPresentInaugurationDeptMgtPowerDetailComRespDto queryPresentInaugurationDeptMgtPowerDetailComRespDto = null;
        QueryPresentInaugurationDeptMgtPowerDetailComReqDto queryPresentInaugurationDeptMgtPowerDetailComReqDto = new QueryPresentInaugurationDeptMgtPowerDetailComReqDto();
        if (reqDto != null) {
            queryPresentInaugurationDeptMgtPowerDetailComReqDto.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:190345_1_12842
        }

        /*D1-2查询当前就职记录部门管理权限详情(公共)[3793]   */
        Assert.isNull(queryPresentInaugurationDeptMgtPowerDetailComReqDto.getDeptId(), "D3查询中基层个人管理权限详情(公共)-D1-2查询当前就职记录部门管理权限详情(公共)-部门ID不能为空", false);
        queryPresentInaugurationDeptMgtPowerDetailComRespDto = powerService.queryPresentInaugurationDeptMgtPowerDetailCom(queryPresentInaugurationDeptMgtPowerDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


//virtualUsage 3-6-03查牵头部门的指标列表  16277
        List<OmsVirtualOrgMemberDept> listOmsVirtualOrgMemberDept = new ArrayList<>();
        QueryVirtualOrgMemberDeptListReq queryVirtualOrgMemberDeptListReq = new QueryVirtualOrgMemberDeptListReq();
        queryVirtualOrgMemberDeptListReq.setDeptType("LEAD_DEPT");//sourceId:200236_1_16277
        queryVirtualOrgMemberDeptListReq.setTableTypeCode("OMS_TARGET_OBJECTIVE");//sourceId:200233_1_16277
        queryVirtualOrgMemberDeptListReq.setEvaluationTemplateType("EVA_TEMP");//sourceId:200244_1_16277
        queryVirtualOrgMemberDeptListReq.setIsArchive("FALSE");//sourceId:200959_1_16277
        queryVirtualOrgMemberDeptListReq.setArchivngType("NOT_ARCHIVE");//sourceId:200960_1_16277
        if (reqDto != null) {
            queryVirtualOrgMemberDeptListReq.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:200231_1_16277
            queryVirtualOrgMemberDeptListReq.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:200241_1_16277
        }

        /*3-6-03查牵头部门的指标列表[2220]   */
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getDeptId(), "D3查询中基层个人管理权限详情(公共)-3-6-03查牵头部门的指标列表-虚拟组织下部门ID不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getDeptType(), "D3查询中基层个人管理权限详情(公共)-3-6-03查牵头部门的指标列表-部门类型编码不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getTableTypeCode(), "D3查询中基层个人管理权限详情(公共)-3-6-03查牵头部门的指标列表-冗余内容表类型编码不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getEvaluationTemplateType(), "D3查询中基层个人管理权限详情(公共)-3-6-03查牵头部门的指标列表-归属对象类型不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getEvaluationTemplateId(), "D3查询中基层个人管理权限详情(公共)-3-6-03查牵头部门的指标列表-归属对象ID不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getIsArchive(), "D3查询中基层个人管理权限详情(公共)-3-6-03查牵头部门的指标列表-是否存档不能为空", false);
        Assert.isNull(queryVirtualOrgMemberDeptListReq.getArchivngType(), "D3查询中基层个人管理权限详情(公共)-3-6-03查牵头部门的指标列表-存档类型不能为空", false);
        listOmsVirtualOrgMemberDept = mOmsVirtualOrgMemberDeptService.queryVirtualOrgMemberDeptList(queryVirtualOrgMemberDeptListReq)/*vcase invoke 本地 method 方法调用;*/;


//virtualUsage 3-6-02批量查当前用户管理的部门牵头指标  16278
        List<OmsVirtualOrgMember> listOmsVirtualOrgMember = new ArrayList<>();
        if (listOmsVirtualOrgMemberDept != null && !CollectionUtil.isEmpty(listOmsVirtualOrgMemberDept) && listOmsVirtualOrgMemberDept.size() > 0) {
            BatchQueryVirtualOrgMemberReq batchQueryVirtualOrgMemberReq = new BatchQueryVirtualOrgMemberReq();
            batchQueryVirtualOrgMemberReq.setTableTypeCode("OMS_TARGET_OBJECTIVE");//sourceId:200249_1_16278
            batchQueryVirtualOrgMemberReq.setVirtualOrgInductionRecordId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID//sourceId:201003_1_16278
            batchQueryVirtualOrgMemberReq.setIsAdmin("TRUE");//sourceId:200259_1_16278
            batchQueryVirtualOrgMemberReq.setIsArchive("FALSE");//sourceId:200962_1_16278
            if (listOmsVirtualOrgMemberDept != null && !CollectionUtil.isEmpty(listOmsVirtualOrgMemberDept) && listOmsVirtualOrgMemberDept != null && !CollectionUtil.isEmpty(listOmsVirtualOrgMemberDept)) {
                batchQueryVirtualOrgMemberReq.setVirtualOrgMemberList(listOmsVirtualOrgMemberDept.stream().map(item -> item.getEntityId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:200246_1_16278
            }

            /*3-6-02批量查当前用户管理的部门牵头指标[2672]   */
            Assert.isNull(batchQueryVirtualOrgMemberReq.getTableTypeCode(), "D3查询中基层个人管理权限详情(公共)-3-6-02批量查当前用户管理的部门牵头指标-冗余内容表类型编码不能为空", false);
            Assert.isNull(batchQueryVirtualOrgMemberReq.getVirtualOrgInductionRecordId(), "D3查询中基层个人管理权限详情(公共)-3-6-02批量查当前用户管理的部门牵头指标-虚拟组织成员就职记录ID不能为空", false);
            Assert.isNull(batchQueryVirtualOrgMemberReq.getIsAdmin(), "D3查询中基层个人管理权限详情(公共)-3-6-02批量查当前用户管理的部门牵头指标-是否管理员不能为空", false);
            Assert.isNull(batchQueryVirtualOrgMemberReq.getIsArchive(), "D3查询中基层个人管理权限详情(公共)-3-6-02批量查当前用户管理的部门牵头指标-是否存档不能为空", false);
            listOmsVirtualOrgMember = mOmsVirtualOrgMemberService.batchQueryVirtualOrgMember(batchQueryVirtualOrgMemberReq)/*vcase invoke 本地 method 方法调用;*/;


        }
//virtualUsage 3-3-05批量查负责的已下发指标  28370
        List<OmsTargetObjectivePlanExtend> listOmsTargetObjectivePlanExtend = new ArrayList<>();
        if (listOmsVirtualOrgMember != null && !CollectionUtil.isEmpty(listOmsVirtualOrgMember) && listOmsVirtualOrgMember.size() > 0) {
            BatchQueryTargetObjPlanExReq batchQueryTargetObjPlanExReq = new BatchQueryTargetObjPlanExReq();
            batchQueryTargetObjPlanExReq.setIsFirstObjective("TRUE");//sourceId:643205_1_28370
            batchQueryTargetObjPlanExReq.setIsArchive("FALSE");//sourceId:643203_1_28370
            if (listOmsVirtualOrgMember != null && !CollectionUtil.isEmpty(listOmsVirtualOrgMember) && listOmsVirtualOrgMember != null && !CollectionUtil.isEmpty(listOmsVirtualOrgMember)) {
                batchQueryTargetObjPlanExReq.setObjectivePlanningExtendList(listOmsVirtualOrgMember.stream().map(item -> item.getEntityId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:643199_1_28370
            }
            if (reqDto != null) {
                batchQueryTargetObjPlanExReq.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:643206_1_28370
            }

            /*3-3-05批量查负责的已下发指标[2816]   */
            Assert.isNull(batchQueryTargetObjPlanExReq.getIsFirstObjective(), "D3查询中基层个人管理权限详情(公共)-3-3-05批量查负责的已下发指标-是否目标下发不能为空", false);
            Assert.isNull(batchQueryTargetObjPlanExReq.getEvaluationTemplateId(), "D3查询中基层个人管理权限详情(公共)-3-3-05批量查负责的已下发指标-冗余评价模板ID不能为空", false);
            Assert.isNull(batchQueryTargetObjPlanExReq.getIsArchive(), "D3查询中基层个人管理权限详情(公共)-3-3-05批量查负责的已下发指标-是否存档不能为空", false);
            listOmsTargetObjectivePlanExtend = mOmsTargetObjectivePlanExtendService.batchQueryTargetObjPlanEx(batchQueryTargetObjPlanExReq)/*vcase invoke 本地 method 方法调用;*/;


        }
        if ((queryPresentInaugurationDeptMgtPowerDetailComRespDto != null && queryPresentInaugurationDeptMgtPowerDetailComRespDto.getDeptId() != null || listOmsTargetObjectivePlanExtend != null && listOmsTargetObjectivePlanExtend != null && listOmsTargetObjectivePlanExtend.size() > 0) && (omsBizAppBatch != null && omsBizAppBatch.getBatchId() != null)) {
            //if((D1-2查询当前就职记录部门管理权限详情(公共).部门ID 值不等于空  or 3-3-05批量查负责的已下发指标.指标扩展规划设置列表数据集条数 大于 0) and 3-13-01查业务应用批次（有批次方可进入管理）.批次ID 值不等于空 )  12843

            //ModelCode: receptionService
            ObtainReceiveFieldRespDto receptionServiceRes = null;
            ObtainReceiveFieldReqDto receptionServiceReq = new ObtainReceiveFieldReqDto();
            receptionServiceReq.setOutputNum(Long.valueOf(1));//CUSTOM_CONVENTION//sourceId:244985_1_16262

            /*M3-有管理权限1[2451]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq.getOutputNum(), "D3查询中基层个人管理权限详情(公共)-M3-有管理权限1-传输数值（整数型）不能为空", false);
            receptionServiceRes = nbPower.obtainReceiveField(receptionServiceReq);


            receptionServiceRes_1 = receptionServiceRes;
        } else {
            //else  28047

            //ModelCode: receptionService
            ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_2 = null;
            ImplementBizConstructAccessParameterFieldReqDto receptionServiceReq_1 = new ImplementBizConstructAccessParameterFieldReqDto();
            receptionServiceReq_1.setOutputNum(Long.valueOf(0));//CUSTOM_CONVENTION//sourceId:329520_1_28048

            /*M3-有管理权限0[4518]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_1.getOutputNum(), "D3查询中基层个人管理权限详情(公共)-M3-有管理权限0-传输数值（整数型）不能为空", false);
            receptionServiceRes_2 = nbPower.implementBizConstructAccessParameterField(receptionServiceReq_1);


            receptionServiceRes_3 = receptionServiceRes_2;
        }
        if ((listOmsVirtualOrgMember != null && listOmsVirtualOrgMember != null && listOmsVirtualOrgMember.size() > 0 && queryPresentInaugurationDeptMgtPowerDetailComRespDto != null && queryPresentInaugurationDeptMgtPowerDetailComRespDto.getDeptId() == null && omsBizAppBatch != null && omsBizAppBatch.getBatchId() != null)) {
            //if((3-6-02批量查当前用户管理的部门牵头指标.虚拟组织成员列表数据集条数 大于 0 and D1-2查询当前就职记录部门管理权限详情(公共).部门ID 值等于空  and 3-13-01查业务应用批次（有批次方可进入管理）.批次ID 值不等于空 ))  16281

//ModelCode: receptionService
            ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_4 = null;
            ImplementBizConstructAccessParameterFieldReqDto receptionServiceReq_2 = new ImplementBizConstructAccessParameterFieldReqDto();
            receptionServiceReq_2.setIsAdmin("TRUE");//sourceId:329376_1_16282

            /*M3确定是指标管理员[4518]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_2.getIsAdmin(), "D3查询中基层个人管理权限详情(公共)-M3确定是指标管理员-是否管理员不能为空", false);
            receptionServiceRes_4 = nbPower.implementBizConstructAccessParameterField(receptionServiceReq_2);


            receptionServiceRes_5 = receptionServiceRes_4;
        } else {
            //else  28045

//ModelCode: receptionService
            ImplementBizConstructAccessParameterFieldRespDto receptionServiceRes_6 = null;
            ImplementBizConstructAccessParameterFieldReqDto receptionServiceReq_3 = new ImplementBizConstructAccessParameterFieldReqDto();
            receptionServiceReq_3.setIsAdmin("FALSE");//sourceId:329410_1_28046

            /*M3默认不是指标管理员[4518]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_3.getIsAdmin(), "D3查询中基层个人管理权限详情(公共)-M3默认不是指标管理员-是否管理员不能为空", false);
            receptionServiceRes_6 = nbPower.implementBizConstructAccessParameterField(receptionServiceReq_3);


            receptionServiceRes_7 = receptionServiceRes_6;
        }
        QueryMidBasicPersonalPowerDetailComRespDto retData = new QueryMidBasicPersonalPowerDetailComRespDto();
        if (receptionServiceRes_3 != null) {
            retData.setOutputNum(receptionServiceRes_3.getOutputNum());//SimpleFieldAssign//sourceId:190698_1
        }
        if (receptionServiceRes_1 != null) {
            retData.setOutputNum(receptionServiceRes_1.getOutputNum());//SimpleFieldAssign//sourceId:190698_1
        }
        if (receptionServiceRes_5 != null) {
            retData.setIsAdmin(receptionServiceRes_5.getIsAdmin());//SimpleFieldAssign//sourceId:329412_1
        }
        if (receptionServiceRes_7 != null) {
            retData.setIsAdmin(receptionServiceRes_7.getIsAdmin());//SimpleFieldAssign//sourceId:329412_1
        }


        return retData;
    }

    /**
     * D3执行分析高中基层超级特权管理权限(公共)[5854]
     * gen by moon at 2/9/2023, 6:12:56 PM
     */
    @Trace(operationName = "D3执行分析高中基层超级特权管理权限(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementAnalyseTopMidBasicSuperMgtPowerComRespDto implementAnalyseTopMidBasicSuperMgtPowerCom(ImplementAnalyseTopMidBasicSuperMgtPowerComReqDto reqDto) {


        ImplementAccessParameterBizFieldRespDto receptionServiceRes_1 = null;
//virtualUsage D2-3查评价模板超级管理功能开启配置  28968
        QueryConfItemMatchAnswerDetailComRespDto queryConfItemMatchAnswerDetailComRespDto = null;
        QueryConfItemMatchAnswerDetailComReqDto queryConfItemMatchAnswerDetailComReqDto = new QueryConfItemMatchAnswerDetailComReqDto();
        queryConfItemMatchAnswerDetailComReqDto.setResultAspObjType("EVA_TEMP");//sourceId:654232_1_28968
        queryConfItemMatchAnswerDetailComReqDto.setConfItemCode("IS_OPEN_SUPER_MGT");//CUSTOM_CONVENTION//sourceId:654231_1_28968
        queryConfItemMatchAnswerDetailComReqDto.setIsPlatData("FALSE");//sourceId:654240_1_28968
        if (reqDto != null) {
            queryConfItemMatchAnswerDetailComReqDto.setResultAspObjId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:654233_1_28968
        }

        /*D2-3查评价模板超级管理功能开启配置[2486]   */
        Assert.isNull(queryConfItemMatchAnswerDetailComReqDto.getResultAspObjId(), "D3执行分析高中基层超级特权管理权限(公共)-D2-3查评价模板超级管理功能开启配置-答案归属对象ID不能为空", false);
        Assert.isNull(queryConfItemMatchAnswerDetailComReqDto.getResultAspObjType(), "D3执行分析高中基层超级特权管理权限(公共)-D2-3查评价模板超级管理功能开启配置-答案归属对象类型不能为空", false);
        Assert.isNull(queryConfItemMatchAnswerDetailComReqDto.getConfItemCode(), "D3执行分析高中基层超级特权管理权限(公共)-D2-3查评价模板超级管理功能开启配置-配置项标识不能为空", false);
        queryConfItemMatchAnswerDetailComRespDto = confSchemeService.queryConfItemMatchAnswerDetailCom(queryConfItemMatchAnswerDetailComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        if ((queryConfItemMatchAnswerDetailComRespDto != null && queryConfItemMatchAnswerDetailComRespDto.getEndValue() != null && queryConfItemMatchAnswerDetailComRespDto.getEndValue().equals("TRUE"))) {
            //if(D2-3查评价模板超级管理功能开启配置.答案值 等于 是)  28969

//ModelCode: receptionService
            ImplementAccessParameterBizFieldRespDto receptionServiceRes = null;
            ImplementAccessParameterBizFieldReqDto receptionServiceReq = new ImplementAccessParameterBizFieldReqDto();
            receptionServiceReq.setOutputNum(Long.valueOf(1));//CUSTOM_CONVENTION//sourceId:654368_1_28988

            /*M3约定为拥有超级管理权限[5797]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq.getOutputNum(), "D3执行分析高中基层超级特权管理权限(公共)-M3约定为拥有超级管理权限-传输数值（整数型）不能为空", false);
            receptionServiceRes = nbPower.implementAccessParameterBizField(receptionServiceReq);


            receptionServiceRes_1 = receptionServiceRes;
        } else if ((queryConfItemMatchAnswerDetailComRespDto != null && queryConfItemMatchAnswerDetailComRespDto.getEndValue() == null || queryConfItemMatchAnswerDetailComRespDto != null && queryConfItemMatchAnswerDetailComRespDto.getEndValue() != null && queryConfItemMatchAnswerDetailComRespDto.getEndValue().equals("FALSE"))) {
            //elseif((D2-3查评价模板超级管理功能开启配置.答案值 值等于空  or D2-3查评价模板超级管理功能开启配置.答案值 等于 否))  28973

//processBranchName:正常结束 ,processBranchId:28974

        }
        ImplementAnalyseTopMidBasicSuperMgtPowerComRespDto retData = new ImplementAnalyseTopMidBasicSuperMgtPowerComRespDto();
        if (receptionServiceRes_1 != null) {
            retData.setOutputNum(receptionServiceRes_1.getOutputNum());//SimpleFieldAssign//sourceId:654370_1
        }


        return retData;
    }
    //
}
